package com.zhny.aiot.head.observe.control.v2.plugin;

import com.zhny.aiot.head.observe.control.v2.plugin.model.HeadControlV2StoreEntry;
import com.zhny.aiot.plugin.ICenterFacilities;
import com.zhny.aiot.plugin.IDevice;
import com.zhny.aiot.plugin.model.CommandEntry;
import com.zhny.aiot.plugin.model.DeviceEntity;
import com.zhny.aiot.plugin.model.FactoryType;
import com.zhny.aiot.plugin.model.StoreEntity;
import com.zhny.aiot.plugin.v2.gateway.GatewayV2Server;
import com.zhny.aiot.plugin.zhnygateway.device.ZhnyDeviceFactory;
import org.pf4j.Extension;
import org.pf4j.Plugin;
import org.pf4j.PluginWrapper;

import java.util.List;

public class HeadControlV2Plugin extends Plugin {
    public HeadControlV2Plugin(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Extension
    public static class HeadControlV2Factory extends ZhnyDeviceFactory<HeadControlV2StoreEntry> {

        @Override
        public List<CommandEntry> supportCommandClasses() {
            List<CommandEntry> commands=super.supportCommandClasses();
            commands.add(CommandEntry.valueOf("openA", "通道A打开", "无参数", null));
            commands.add(CommandEntry.valueOf("closeA", "通道A关闭", "无参数", null));
            commands.add(CommandEntry.valueOf("openB", "通道B打开", "无参数", null));
            commands.add(CommandEntry.valueOf("closeB", "通道B关闭", "无参数", null));
            commands.add(CommandEntry.valueOf("queryStatus", "查询通道状态", "无参数", null));
            return commands;
        }

        public IDevice createDevice(ICenterFacilities iCenterFacilities, DeviceEntity entity) {
            return new HeadControlV2Device (GatewayV2Server.getInstance ().getEngine(), this, iCenterFacilities, entity);
        }

        public Class<? extends StoreEntity> storeClass() {
            return HeadControlV2StoreEntry.class;
        }

        public String getId() {
            return "zhny-head-observe-control-v2-plugin";
        }

        public String getName() {
            return "智慧首部测控终端V2插件";
        }

        public FactoryType getType() {
            return FactoryType.PumpController;
        }
    }
}
